package {
	import com.fastframework.utils.MovieClipTools;

	import flash.display.MovieClip;
	import flash.text.TextField;

	/**
	 * @author colin
	 */
	final public class Logger {
		private static var ins:Logger;
		public static function instance():Logger {
			ins ||=new Logger(new SingletonBlocker());
			return ins;
		}

		public function Logger(p_key:SingletonBlocker) {
		}
		public var enable:Boolean = true;
		private var txt:TextField;
		public function setView(mc:MovieClip):void{
			txt = MovieClipTools.findTextField(mc);
		}
		public function log(str:String):void{
			if(enable==false)return;
			if(txt!=null){
				txt.appendText(str+'\n');
			}else{
				trace(str);
			}
		}
	}
}
class SingletonBlocker{}